package com.eternal.base.data.ble;

import com.eternal.base.database.entity.History;
import com.eternal.base.protocol.CFamilialResolution;

public class HistoryCParse extends BaseParse<History> {
    private int time;

    @Override
    boolean checkLength() {
        return i + 4 < now.length;
    }

    @Override
    History parse() {
        History history = CFamilialResolution.parseHistory(now, i, time);
        i += 4;
        time++;
        --total;
        return history;
    }

    public void setTime(int time) {
        this.time = time;
    }

    @Override
    void init() {
        total = now[13] & 0xff;
        i = 14;
    }
}
